package inabit.fuzzy.data;

/**Returns a fuzzy function at the gaussian funciton shape with
 * specified mean and standard deviation
 * @author Rafael Rocha*/
public class GaussianFunction implements FuzzyFunction{
	private double mean;
	private double dp;
	private double var;
	
	public GaussianFunction(double mean, double sd) {
		this.mean = mean;
		this.dp = sd;
		this.var = sd*sd;
	}
	public double f(double x) {
		return (1.0/(dp*Math.sqrt(2*Math.PI)))*
					Math.pow(Math.E,
							-((Math.pow(x-mean, 2)/(2*var))));
	}
}
